<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="./../templates/StaffTemplate.xhtml">

    <ui:define name="nav_menu">
        <p:menubar model="#{viewTrashManagedBean.staffMenuModel}"/>
    </ui:define>

    <ui:define name="content">
        <f:view beforePhase="#{viewTrashManagedBean.initView}">
            <h:form>
                <p:panel header="Trash Bin">
                    <p:messages id="statusMessages" redisplay="true" />
                    <h:panelGrid columns="1" cellpadding="1" >

                        <h:outputText id="resultList" value="Total trash items: #{viewTrashManagedBean.messageList.size()}" 
                                      style="font-size: 10px; color: red; float: right;"/>

                        <p:dataTable id="adListTable" var="message" 
                                     rendered="true" value="#{viewTrashManagedBean.messageList}"
                                     style="width:850px;">

                            <p:column filterBy="#{message.receiver}" style="width: 20%">  
                                <f:facet name="header">  
                                    To:
                                </f:facet>  
                                <h:outputText value="#{message.receiver}" style="font-weight: bold"/>

                            </p:column> 


                            <p:column filterBy="#{message.subject}" style="width: 45%">  
                                <f:facet name="header">  
                                    Subject
                                </f:facet> 
                                <h:commandLink value="#{message.subject}"
                                               actionListener="#{viewOutboxManagedBean.view_Message(message)}"/>
                            </p:column> 

                            <p:column> 
                                <f:facet name="header">  
                                    Date Sent
                                </f:facet>  
                                <h:outputText value="#{message.msgDate}">
                                    <f:convertDateTime dateStyle="long" type="both"/>
                                </h:outputText>
                            </p:column> 
                        </p:dataTable>    
                    </h:panelGrid>
                </p:panel>
            </h:form>
        </f:view>
    </ui:define>
</ui:composition>
